<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .active {
      color: red;
    }
  </style>
</head>
<body>
<div id="app">
  <h1>
    <ul>
      <li :class="{active: index === currentIndex}" @click="getClasses(index)" v-for="(m,index) in movies">{{m}}</li>
    </ul>
  </h1>
</div>

<script src="../js/vue.js"></script>
<script>
  //let(变量)和const(常量)
  const app = new Vue({
    el: '#app',
    data: {
      isActive: true,
      movies: ['华为', '华硕', '华夏', '小米'],
      currentIndex: 0
    },
    methods: {
      getClasses(index) {
        this.currentIndex = index;
      }
    }
  })
</script>
</body>
</html>